home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / term-source.lha / xem.h < prev    next >
C/C++ Source or Header  |  1996-10-20  |  5KB  |  152 lines

  1. /**
  2.  *
  3.  *   Include file for External Emulator Handling
  4.  *
  5.  **/
  6.  
  7. #ifndef _COMPILER_H
  8. #define REG(x) register __ ## x
  9. #define ASM __asm
  10. #endif    /* _COMPILER_H */
  11.  
  12. /*
  13.  *   The xem_option structure
  14.  */
  15.  
  16. struct xem_option
  17. {
  18.     STRPTR    xemo_description;    /* description of the option                  */
  19.     ULONG    xemo_type;        /* type of option                             */
  20.     STRPTR    xemo_value;        /* pointer to a buffer with the current value */
  21.     ULONG    xemo_length;        /* buffer size                                */
  22. };
  23.  
  24. /*
  25.  *   Valid values for xemo_type are:
  26.  */
  27.  
  28. #define XEMO_BOOLEAN 1L         /* xemo_value is "yes", "no", "on" or "off"   */
  29. #define XEMO_LONG    2L         /* xemo_value is string representing a number */
  30. #define XEMO_STRING  3L         /* xemo_value is a string                     */
  31. #define XEMO_HEADER  4L         /* xemo_value is ignored                      */
  32. #define XEMO_COMMAND 5L         /* xemo_value is ignored                      */
  33. #define XEMO_COMMPAR 6L         /* xemo_value contains command parameters     */
  34.  
  35. struct XEmulatorMacroKey
  36. {
  37.     struct MinNode    xmk_Node;
  38.     UWORD        xmk_Qualifier;
  39.     UBYTE        xmk_Type;
  40.     UBYTE        xmk_Code;
  41.     APTR        xmk_UserData;
  42. };
  43.  
  44. /*----- Qualifiers for XMK_QUALIFIER -----*/
  45.  
  46. #define XMKQ_NONE      0
  47. #define XMKQ_SHIFT     1
  48. #define XMKQ_ALTERNATE 2
  49. #define XMKQ_CONTROL   3
  50.  
  51. /*----- Types for XMK_TYPE -----*/
  52.  
  53. #define XMKT_IGNORE 1
  54. #define XMKT_RAWKEY 2
  55. #define XMKT_COOKED 3
  56.  
  57.  
  58. /*----- Types for XEmulatorInfo -----*/
  59.  
  60. #define XEMI_CURSOR_POSITION    1    /* home = 1,1 */
  61. #define XEMI_CONSOLE_DIMENSIONS    2
  62.  
  63. /*----- Macros for XEmulatorInfo -----*/
  64.  
  65. #define XEMI_EXTRACT_Y_POSITION(result)    (result >> 16)
  66. #define XEMI_EXTRACT_X_POSITION(result)    (result & 0xffff)
  67.  
  68. #define XEMI_EXTRACT_COLUMNS(result)    (result >> 16)
  69. #define XEMI_EXTRACT_LINES(result)    (result & 0xffff)
  70.  
  71. /*----- Modes for XEmulatorPreferences -----*/
  72.  
  73. #define XEM_PREFS_RESET    0    /* Reset to builtin defaults    */
  74. #define XEM_PREFS_LOAD    1    /* Load preferences from file    */
  75. #define XEM_PREFS_SAVE    2    /* Save preferences to file    */
  76.  
  77.  
  78. struct XEmulatorHostData
  79. {
  80.     STRPTR    Source;
  81.     STRPTR    Destination;
  82.     BOOL    InESC;        /* INTER-EMULATOR PRIVATE DATA..  DO NOT TOUCH 'EM..!! */
  83.     BOOL    InCSI;        /* INTER-EMULATOR PRIVATE DATA..  DO NOT TOUCH 'EM..!! */
  84. };
  85.  
  86. /*
  87.  *   The structure
  88.  */
  89.  
  90. struct XEM_IO
  91. {
  92.     struct Window    *xem_window;
  93.     struct TextFont    *xem_font;
  94.     APTR         xem_console;
  95.     STRPTR         xem_string;
  96.     ULONG        *xem_signal;
  97.     UWORD         xem_screendepth;
  98.     UWORD         xem_pad;
  99.  
  100.     LONG        (* ASM xem_sread)(REG(a0) APTR,REG(d0) LONG,REG(d1) ULONG);
  101.     LONG        (* ASM xem_swrite)(REG(a0) STRPTR,REG(d0) LONG);
  102.     LONG        (*     xem_sflush)(VOID);
  103.     LONG        (*     xem_sbreak)(VOID);
  104.     LONG        (*     xem_squery)(VOID);
  105.     VOID        (*     xem_sstart)(VOID);
  106.     LONG        (*     xem_sstop)(VOID);
  107.  
  108.     VOID        (* ASM xem_tbeep)(REG(d0) ULONG,REG(d1) ULONG);
  109.     LONG        (* ASM xem_tgets)(REG(a0) STRPTR,REG(a1) STRPTR,REG(d0) ULONG);
  110.     ULONG        (* ASM xem_toptions)(REG(d0) LONG,REG(a0) struct xem_option **);
  111.  
  112.     LONG        (* ASM xem_process_macrokeys)(REG(a0) struct XEmulatorMacroKey *);
  113. };
  114.  
  115. BOOL    XEmulatorSetup(struct XEM_IO *io);
  116. BOOL    XEmulatorOpenConsole(struct XEM_IO *io);
  117. VOID    XEmulatorCloseConsole(struct XEM_IO *io);
  118. VOID    XEmulatorCleanup(struct XEM_IO *io);
  119. VOID    XEmulatorWrite(struct XEM_IO *io, STRPTR string, ULONG len);
  120. BOOL    XEmulatorSignal(struct XEM_IO *io, ULONG sig);
  121. ULONG    XEmulatorHostMon(struct XEM_IO *io, struct XEmulatorHostData *hd, ULONG actual);
  122. ULONG    XEmulatorUserMon(struct XEM_IO *io, STRPTR retstr, ULONG maxlen, struct IntuiMessage *imsg);
  123. BOOL    XEmulatorOptions(struct XEM_IO *io);
  124. BOOL    XEmulatorClearConsole(struct XEM_IO *io);
  125. BOOL    XEmulatorResetConsole(struct XEM_IO *io);
  126. BOOL    XEmulatorResetTextStyles(struct XEM_IO *io);
  127. BOOL    XEmulatorResetCharset(struct XEM_IO *io);
  128. ULONG    XEmulatorGetFreeMacroKeys(struct XEM_IO *io, ULONG qualifier);
  129. BOOL    XEmulatorMacroKeyFilter(struct XEM_IO *io, struct List *keys);
  130. ULONG    XEmulatorInfo(struct XEM_IO *xem_io, ULONG type);
  131. BOOL    XEmulatorPreferences(struct XEM_IO *xem_io, STRPTR fileName, ULONG mode);
  132.  
  133. #ifndef NO_PRAGMAS
  134. #pragma libcall XEmulatorBase XEmulatorSetup 1E 801
  135. #pragma libcall XEmulatorBase XEmulatorOpenConsole 24 801
  136. #pragma libcall XEmulatorBase XEmulatorCloseConsole 2A 801
  137. #pragma libcall XEmulatorBase XEmulatorCleanup 30 801
  138. #pragma libcall XEmulatorBase XEmulatorWrite 36 9803
  139. #pragma libcall XEmulatorBase XEmulatorSignal 3C 802
  140. #pragma libcall XEmulatorBase XEmulatorHostMon 42 9803
  141. #pragma libcall XEmulatorBase XEmulatorUserMon 48 A09804
  142. #pragma libcall XEmulatorBase XEmulatorOptions 4E 801
  143. #pragma libcall XEmulatorBase XEmulatorClearConsole 54 801
  144. #pragma libcall XEmulatorBase XEmulatorResetConsole 5A 801
  145. #pragma libcall XEmulatorBase XEmulatorResetTextStyles 60 801
  146. #pragma libcall XEmulatorBase XEmulatorResetCharset 66 801
  147. #pragma libcall XEmulatorBase XEmulatorGetFreeMacroKeys 6c 802
  148. #pragma libcall XEmulatorBase XEmulatorMacroKeyFilter 72 9802
  149. #pragma libcall XEmulatorBase XEmulatorInfo 78 802
  150. #pragma libcall XEmulatorBase XEmulatorPreferences 7E 9803
  151. #endif    /* NO_PRAGMAS */
  152.